package com.group.three.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.group.three.mapper.UserLogMapper;
import com.group.three.pojo.UserLog;
import com.group.three.service.UserLogService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class UserLogServiceImpl implements UserLogService {
    @Autowired
    private UserLogMapper userLogMapper;
    @Override
    public int insertLog(Long userlogId, Long personId, String ip,String address,LocalDateTime now) {
        return userLogMapper.insertLog(userlogId,personId,ip,address,now);
    }


    @Override
    public PageInfo<UserLog> selectLogsById(int page, int size, Long personId) {
        PageHelper.startPage(page,size);
        List<UserLog> userLogs = userLogMapper.selectLogById(personId);
        PageInfo<UserLog> pageInfo=new PageInfo<UserLog>(userLogs,page);
        return pageInfo;
    }
}
